package net.xo68.destiny.contract.enums.handler;

/**
 * worker任务处理阶段
 * @author wuxie
 * @version 2020-11-4
 */
public enum JobHandlePhaseEnum {

    /**
     * 开始
     */
    START(0),
    /**
     * 运行
     */
    RUNNING(1),
    /**
     * 完成
     */
    FINISH(2);

    private final int state;

    JobHandlePhaseEnum(int state) {
        this.state = state;
    }

    public int getState() {
        return state;
    }

    public static JobHandlePhaseEnum of(int state){
        for (JobHandlePhaseEnum item: JobHandlePhaseEnum.values()) {
            if (item.getState()== state) {
                return item;
            }
        }
        return null;
    }
}
